package com.cbs.android.function.qrcodescan.sample;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.cbs.android.component.application.activity.CBSActivity;
import com.cbs.android.component.toast.Toast;
import com.cbs.android.function.qrcodescan.QRCodeScanFunction;
import com.cbs.android.function.qrcodescan.QRCodeScanHandler;

public class MainActivity extends CBSActivity {
    private static final String TAG = MainActivity.class.getName();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toast.init(this);
    }

    public void scan(View view) {
        QRCodeScanFunction.scan(this, new QRCodeScanHandler() {
            @Override
            public void onScanSuccess(int requestCode, Intent intent, String code) {
                Toast.show(code);
            }

            @Override
            public void onCancel(int i, Intent intent) {
                Toast.show("cancel");
            }
        });
    }
}
